<?php 
if(!isset($_SESSION['tkemail'])){
		if(!isset($_COOKIE['role'])){
			//$_SESSION['action']='entry';
			header( 'Location: index.php?action=entry' );
		}else{
			$_SESSION['tkemail']=$_COOKIE["tkemail"];
		    $_SESSION['role']=$_COOKIE["role"];
			
			$role=$_SESSION['role'];
			$tkemail=$_SESSION['tkemail'];
		}
	}else{
		$role=$_SESSION['role'];
		$tkemail=$_SESSION['tkemail'];
	}
	if($tkemail==""){
		header( 'Location: index.php?action=entry' );
	}
?>
<style>
* {font-family:Arial, Helvetica, sans-serif; font-size:14px}
#fade { /*--Transparent background layer--*/
        display: none; /*--hidden by default--*/
        background: #727272;
        position: fixed; left: 0; top: 0;
        width: 100%; height: 100%;
        opacity: .50;
        z-index: 9999;
}
.popup_block{
        display: none; /*--hidden by default--*/
        background:url(images/bgn.png);
       
		border-radius: 8px;
        float: left;
        font-size: 1.2em;
        position: fixed;
        top: 50%; left: 50%;
        z-index: 99999;
		width:463px;
		height:264px;
		
        /*--CSS3 Box Shadows--*/
        /*--CSS3 Rounded Corners--*/
}
.btn_close {
	background:url(images/close.png);
        float: right;
        margin: -10px -10px 0 0;
		width:30px;
		height:30px;	
}
/*--Making IE6 Understand Fixed Positioning--*/
*html #fade {
        position: absolute;
}
*html .popup_block {
        position: absolute;
}

.btnupbg {
	/*background: none repeat scroll 0 0 #79AA38;*/
	background:url(images/btn.png) no-repeat;
    border-color: #C4C0B9;
    border-radius: 5px 5px 5px 5px;
    border-width: 0;
    color: white;
    cursor: pointer;
    font-weight: bold;
    height: 28px;
    margin: 6px 0 0 20px;
    padding: 0 5px;
    width: 65px;}
.btnupbg:hover {background:#309DCF}
.btnupload {background: -moz-linear-gradient(center top , #63B6DB, #309DCF) repeat;}
.text{ height:24px;}
</style>
<link rel="stylesheet" type="text/css" href="css/style-login.css" />
<script type="text/javascript">
<!--
function changePass()
{
	var oldpass=document.getElementById("oldpass").value;
	var newpass1=document.getElementById("newpass1").value;
	var newpass2=document.getElementById("newpass2").value;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("popup_name").innerHTML=xmlhttp.responseText;
										    	if(document.getElementById("thongbao").value=="success"){
											    	 $(' .popup_block').fadeOut(function() {
											              $('#fade, a.close').remove();  
														});
										    	}
										  }
									  }
	xmlhttp.open("GET","ajax/showErrorChangePass.php?action=chPass&oldpass="+oldpass+"&newpass1="+newpass1+"&newpass2="+newpass2,true);
	xmlhttp.send();
}
function cancelPass()
{
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("popup_name").innerHTML=xmlhttp.responseText;
										    	
										  }
									  }
	xmlhttp.open("GET","ajax/showErrorChangePass.php?action=ccPass",true);
	xmlhttp.send();
}
//-->
</script>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>

		<div id="popup_name" class="popup_block" style="background: url('images/bgn.png') !important;">
			<input type="hidden" name="action" value="profile" />
	   		<table style="margin:26px 7px 7px 7px; no-repeat; width:447px; height:230px">
		    	<tr>
		    	<td style=" width:160px; height:24px; padding:40px 0 0 34px; "><b style="font-size:16px;color: #027acc;"><?=$passwdold?></b></td>
		        <td valign="top"><input  name="passold" id="oldpass" type="password" style="height:28px;width:208px; border:1px solid #ccc; border-radius: 5px; margin:40px 0 0 0;"  value="" /></td>
		        </tr>
		        <tr >
		        <td style=" width:160px; height:24px; padding:0px 0 0 34px; "><b style="color: #027acc;font-size:16px"><?=$passwdnew1?></b></td>
		        <td valign="top"><input name="passnew1" id="newpass1" type="password" style="height:28px;width:208px; border:1px solid #ccc; border-radius: 5px; margin:8px 0 0 0;"  value="" /></td>
		        </tr>
		        <tr>
		        <td style=" width:160px; height:24px; padding:0px 0 0 34px; "><b style="color: #027acc;font-size:16px"><?=$passwdnew2?></b></td>
		        <td valign="top"><input name="passnew2" id="newpass2"  type="password" style="height:28px;width:208px; border:1px solid #ccc; border-radius: 5px; margin:8px 0 0 0;" value="" /></td>
		        </tr>
		        <tr>
		        	<td></td>
		            <td>
		            <input type="button" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;background: url('images/btn.png') !important;" class="btnupbg " value="<?=$agree?>" name="changePass" onclick="changePass()" />
		            <input type="button" class="btnupbg  iclose" style="font-family:Arial, Helvetica, sans-serif; font-size:12px;background: url('images/btn.png') !important;" value="<?=$cancel?>"  name="cancel" onclick="cancelPass()" /></td>
		        </tr>
	    	</table>
	    
	    </div>

    <div class="maincon1">
        <div class="hbox">
           <h2><?=$login?> </h2>
            <p><?=$login1?></p>
             <div class="seldown">
            	<ul>
			<?php if ($role==0){?>
				<li class="hoso" style="float:left;">
		        	<a onclick="changePage('profile')" style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px;cursor: pointer;"><span class="chooseprofile"><?=$hoso?></span></a>
		        </li>
		        <li class="giayphep" style="float:left;">
		        	<a href="#" onclick="changePage('license')"  style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
		        </li>
			<?php }else if ($role==1){?>
				<li class="hoso" style="float:left;">
		        	<a onclick="changePage('profile')" style="background:url(images/bg_aa.png) no-repeat; display:block; width:145px; height:71px;cursor: "><span class="chooseprofile"><?=$hoso?></span></a>
		        </li>
		        <li class="giayphep" style="float:left;">
		        	<a href="#" onclick="changePage('license')"  style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$namelicense?></span></a>
		        </li>
		        <li class="server" style="float:left;">
		        	<a href="#"  onclick="changePage('log_server')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logserver?></span></a>
		        </li>
		        <li class="viewer" style="float:left;">
		        	<a href="#"  onclick="changePage('logviewer')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logviewer?></span></a>
		        </li>
		        <li class="viewertoserver" style="float:left;">
		        	<a href="#"  onclick="changePage('log_viewertoserver')" style="background:url(images/bg_aa_normal.png) no-repeat; display:block; width:145px; height:71px"><span><?=$logviewertoserver?></span></a>
		        </li>
			<?php }?>
		    	
	  	  </ul>
            </div>
        </div>
    </div>

    <div class="maind">
    	<div class="info">
    		
            <h2> <?=$hoso1?></h2>
            <ul id="infomation" style="width: 440px;">
            	
	            <li>
	            	<span class="left"><?=$hoso2?></span><span class="lid"><?=$_SESSION['tkemail']?></span>
	           
	            </li>
	            <!--li>
	            	
	            	<span class="left"><?=$hoso3?></span>
	            	     <span class="lid">vietducitdfdf@gmail.com <a href="">Sửa</a>
	            	<span class="lid">    
					<a href="#"  ><?=$add?></a>
					</span>
			
	            </li-->
								 <li>
	            <span class="left"><?=$namepasswd?></span><span class="lid"><a href="#?w=463" onclick="popuploadbel(this)" rel="popup_name" class="poplight"><?=$chpasswd?></a></span>
	           
	            </li>
          
            </ul>
        </div>
    </div>
    
